<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>添加会员</title>
    <link rel="stylesheet" href="../../style/member/addUser.css">
    <link rel="stylesheet" href="../../libs/bootstrap-5.3.0-alpha1-dist/css/bootstrap.css">
    <script src="../../js/vue-2.6.12.js"></script>
    <script src="../../js/axios-0.21.0.js"></script>
    <script src="../../js/qs-6.9.4.js"></script>
    <script src="../../js/vue-router-3.4.9.js"></script>
</head>

<body>

    <div class="containers" id="app">
        <h3>会员</h3>
        <hr>
        <div class="container-basic">
            <h2>会员添加</h2>
            <form class="form-inline">
                <div class="form-group">
                    <label for="add-ename">真实姓名:</label>
                    <input type="text" class="form-control" id="add-ename" placeholder="真实姓名" v-model="member.realName" >
                </div>
                <div class="form-group">
                    <label for="add-ename">昵称:</label>
                    <input type="text" class="form-control" id="add-ename" placeholder="昵称" v-model="member.nickName">
                </div>
                <div class="form-group">
                    <label for="add-ename">手机号:</label>
                    <input type="text" class="form-control" id="add-ename" placeholder="手机号" v-model="member.mobile">
                </div>
                <div class="form-group">
                    <label for="">性别</label>
                    <select class="form-control" id="add-pid" style="width: 200px;" v-model="member.sex">

                        <option value="男">男</option>
                        <option value="女">女</option>
                    </select>
                </div>
                <div class="form-group">
                    <label for="add-ename">年龄:</label>
                    <input type="text" class="form-control" id="add-ename" placeholder="年龄" v-model="member.age">
                </div>
                <div class="form-group">
                    <label for="">会员等级</label>
                    <select class="form-control" id="add-pid" style="width: 200px;" v-model="member.level">
                        <option value="1">VIP1</option>
                        <option value="2">VIP2</option>
                        <option value="3">VIP3</option>
                        <option value="4">VIP4</option>

                    </select>
                </div>
                <div class="form-group">
                    <label for="">状态</label>
                    <select class="form-control" id="add-pid" style="width: 200px;" v-model="member.state">
                        <option value="1">正常</option>
                        <option value="0">冻结</option>
                    </select>
                </div>
            </form>
            <button type="button" class="btn btn-primary" @click="addMember">添加</button>
        </div>

    </div>
<script>
    const app=new Vue({
        el:"#app",
        data:{
            member:{}
        },
        methods:{
          addMember(){
              axios.post("/shop/member/addMember",Qs.stringify(this.member)).then(res=>{
                  if(res.data){
                      alert("添加成功");
                      location.href="index.html";
                  }else{
                      alert("添加失败");}
                  }).catch(e=>{
                      console.log(e);
              })
        }
        }
    })
</script>
</body>

</html>